<template>
  <div class="commodity">
    <div class="last_f">
      <div
        class="lise"
        v-for="(item, index) in status == 0 ? goodsrob : goodsnew"
        :key="index"
      >
        <!-- 图片 -->
        <div class="img">
          <img :src="item.picture" alt="" />
        </div>
        <!-- 信息 -->
        <div class="information">
          <!-- 商品名 -->
          <h4>{{ item.name }}</h4>
          <!-- 价格 -->
          <div class="pri">
            <div class="price_f">
              <span>爆爆团价</span>
              <div class="price">
                <span><b>￥</b>{{ item.min_price }}</span>
                <!-- 折扣 -->
                <span v-show="item.promotion_info != ''">{{
                  item.promotion_info
                }}</span>
              </div>
              <span class="unit">{{ item.unit }}</span>
            </div>
            <!-- 马上抢 -->
            <div class="rob">
              <span @click="alter(item)">{{
                item.alt ? "去使用" : "马上抢"
              }}</span>
              <span>{{ item.month_saled_content }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    status: { type: Number, default: 0 },
    goodsrob: { type: Array, default: [] },
    goodsnew: { type: Array, default: [] },
  },
  data() {
    return {
      // goodsArr: [],
    };
  },
  methods: {
    alter(item) {
      item.alt = true;
    },
    text() {
      console.log(this.status);
    },
  },
};
</script>

<style lang="scss" scoped>
.lise {
  display: flex;
  justify-content: space-between;
  margin: 10px;
  padding: 10px;
  background-color: rgb(234, 234, 234);
  border-radius: 10px;
  height: 120px;
}
.lise .img {
  width: 120px;
  height: 120px;
}
.lise .img img {
  width: 110px;
  height: 110px;
  margin-top: 6px;
  border-radius: 5px;
}
.lise .information {
  flex: 2;
}
.lise .information h4 {
  font-size: 16px;
  line-height: 30px;
}
.lise .information .price_f {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.lise .information .price_f > span:nth-child(1) {
  font-size: 12px;
  color: coral;
  font-weight: bold;
  line-height: 12px;
}
.lise .information .pri {
  margin-top: 3px;
  display: flex;
  justify-content: space-between;
}
.lise .information .price_f .price b {
  font-size: 12px;
}
.lise .information .price_f .price span:nth-child(1) {
  font-size: 12px;
  font-weight: bold;
  color: coral;
}
.lise .information .price_f .price span:nth-child(2) {
  display: inline-block;
  border: 1px solid coral;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 5px;
  color: coral;
  font-weight: bold;
}
.lise .information .price_f .unit {
  color: #999;
  font-size: 12px;
  line-height: 20px;
}
.lise .information .rob {
  display: flex;
  width: 80px;
  flex-direction: column;
}
.lise .information .rob span:nth-child(1) {
  padding: 5px 10px;
  background-color: #ea3a24;
  text-align: center;
  border-radius: 15px;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  margin: 5px 0;
}
.lise .information .rob span:nth-child(2) {
  font-size: 12px;
  color: coral;
  line-height: 20px;
  text-align: center;
}
</style>